package com.elink.enginerring.swagger;

import static springfox.documentation.builders.PathSelectors.regex;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


@Configuration
@EnableWebMvc
@EnableSwagger2
public class SwaggerConfig {

	@Bean
    public Docket apiDocket1(){
        ApiInfo apiInfo = new ApiInfo(
                "SwaggerDemo",
                "RestFulApi",
                "1.0",
                "http://elinkgroup.net",
                "elink",
                "",
                ""
        );
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("api")
                .apiInfo(apiInfo)
                .genericModelSubstitutes(ResponseEntity.class)
                .select()
                .paths(regex("/api/.*"))
                .build();
    }
}
